﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace SABnzbdNET.Model
{
    [Serializable, XmlRoot("queue")]
    public class ServerInfo
    {
        [XmlElement(ElementName = "status")]
        public string Status { get; set; }

        [XmlIgnore]
        public bool Paused { get { return PausedAsString.Equals("true", StringComparison.OrdinalIgnoreCase); } }
        [XmlElement(ElementName = "paused")]
        public string PausedAsString { get; set; }
       
        [XmlElement(ElementName = "uptime")]
        public string UpTime { get; set; }

        [XmlIgnore]
        public bool RestartRequired { get { return RestartRequiredAsString.Equals("true", StringComparison.OrdinalIgnoreCase); } }
        [XmlElement(ElementName = "restart_req")]
        public string RestartRequiredAsString { get; set; }

        [XmlElement(ElementName = "last_warning")]
        public string LastWarning { get; set; }

        [XmlElement(ElementName = "kbpersec")]
        public decimal KbPerSec { get; set; }

        [XmlElement(ElementName = "timeleft")]
        public string TimeLeft { get; set; }

        [XmlElement(ElementName = "mb")]
        public string TotalSize { get; set; }

        [XmlArray(ElementName="slots")]
        [XmlArrayItem(ElementName="slot", Type=typeof(Job))]
        public List<Job> Jobs { get; set; }

        [XmlArray(ElementName = "categories")]
        [XmlArrayItem(ElementName = "category", Type = typeof(string))]
        public List<string> Categories { get; set; }

        [XmlArray(ElementName = "scripts")]
        [XmlArrayItem(ElementName = "script", Type = typeof(string))]
        public List<string> Scripts { get; set; }
    }
}
